package com.gpnu7_412.yanzhi.dto;

import com.gpnu7_412.yanzhi.entity.Dynamic;
import com.gpnu7_412.yanzhi.entity.User;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.sql.Timestamp;

/**
 * 动态展示DTO
 * @author ZZH
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class DynamicDisplayDto {
    /**
     * 作者ID
     */
    private Integer userId;
    /**
     * 作者名
     */
    private String userName;
    /**
     * 作者头像
     */
    private String avatar;
    /**
     * 动态ID
     */
    private Integer dynamicId;
    /**
     * 标题
     */
    private String title;
    /**
     * 内容
     */
    private String content;
    /**
     * 发布时间
     */
    private Timestamp publishTime;
    /**
     * 点赞数
     */
    private Integer likeNum;

    public DynamicDisplayDto(User user, Dynamic dynamic) {
        this.userId = user.getUserId();
        this.userName = user.getUserName();
        this.avatar = user.getAvatar();

        this.dynamicId = dynamic.getDynamicId();
        this.title = dynamic.getTitle();
        this.content = dynamic.getContent();
        this.publishTime = dynamic.getPublishTime();
        this.likeNum = dynamic.getLikeNum();
    }
}
